import axios from 'axios'

// 创建单个实例对象
const instance = axios.create({
  timeout: 10000
})

instance.interceptors.response.use(res => res.data, err => {
  // 在响应拦截器中，对于请求异常行进行统一性处理
  // console.log('老弟你请求没有成功')
  return Promise.reject(err)
})

export const get = (url, config = {}) => instance.get(url, config)
export const post = (url, data = {}, config = {}) => instance.post(url, data, config)